package com.zhengtoon.mctoon.conv.controller;

import com.bjtoon.framework.entity.ResponseResult;
import com.zhengtoon.mctoon.conv.bean.CityItem;
import com.zhengtoon.mctoon.conv.bean.ws.BaseLetter;
import com.zhengtoon.mctoon.conv.bean.ws.ZFHFAppBJTUserLetterService4JKC;
import com.zhengtoon.mctoon.conv.dto.CommentListQueryDto;
import com.zhengtoon.mctoon.conv.dto.mybatis.Page;
import com.zhengtoon.mctoon.conv.exception.ConvPhotoExceptionCode;
import com.zhengtoon.mctoon.conv.service.ConvCommentService;
import com.zhengtoon.mctoon.conv.service.sdzc.ZfhfSystemService;
import com.zhengtoon.mctoon.conv.utils.AppConstant;
import com.zhengtoon.mctoon.conv.utils.CityIntegralUtils;
import com.zhengtoon.mctoon.conv.utils.SysConfig;
import com.zhengtoon.mctoon.conv.vo.DelCommentVo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 评论管理
 */
@RestController
@RequestMapping("/test")
@Api(value = "test", description = "test")
public class TestCxfController extends BaseController {

    private static final Logger log = LoggerFactory.getLogger(TestCxfController.class);

    @Autowired
    private ConvCommentService convCommentService;


    @Autowired
    private ZfhfSystemService zfhfService;  // 中科软系统服务

    /**
     * 搜索评论
     *
     * @return ResponseResult
     */
    @ApiOperation(value = "cxf ", httpMethod = "GET", notes = "cxf")
    @RequestMapping(value = "/cxf", method = RequestMethod.GET)
    public ResponseResult cxf() {
        try {
            BaseLetter letterList = zfhfService.getCommunityLetterList();
            log.info("zfhf system address==" + SysConfig.getPropertyValue("config.zfhfAddress"));

            return ResponseResult.success(letterList == null ? "空数据" : letterList.getFinishedLetterList().toString());

        } catch (Exception e) {
            log.error("cxf()方法error", e);
            return ResponseResult.fail("", "cxf()方法error");
        }
    }

    /**
     * 搜索评论
     *
     * @return ResponseResult
     */
    @ApiOperation(value = "testCity ", httpMethod = "GET", notes = "cxf")
    @RequestMapping(value = "/testCity", method = RequestMethod.GET)
    public ResponseResult testCity() {
        try {
            List<CityItem> list = CityIntegralUtils.getCityIntegralConfig();

            log.info("城市积分" + list);

            return ResponseResult.success(list);

        } catch (Exception e) {
            log.error("testCity()方法error", e);
            return ResponseResult.fail("", "testCity()方法error");
        }
    }

}